﻿<Window x:Class="TestApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:local="clr-namespace:TestApp"
        Title="{Binding Title}" Height="246" Width="466">
    <Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition />
		</Grid.RowDefinitions>
		<Grid Margin="5">
			<Grid.RowDefinitions>
				<RowDefinition/>
				<RowDefinition/>
				<RowDefinition/>
			</Grid.RowDefinitions>
			<TextBox Name="Address" VerticalContentAlignment="Center">
				<TextBox.Text>
					<Binding Path="Uri" UpdateSourceTrigger="PropertyChanged">
						<Binding.ValidationRules>
							<local:ValidUriRule/>
						</Binding.ValidationRules>
					</Binding>
				</TextBox.Text>
			</TextBox>
			<TextBox Name="Download" VerticalContentAlignment="Center" Grid.Row="1">
				<TextBox.Text>
					<Binding Path="DownloadUri" UpdateSourceTrigger="PropertyChanged">
						<Binding.ValidationRules>
							<local:ValidUriRule/>
						</Binding.ValidationRules>
					</Binding>
				</TextBox.Text>
			</TextBox>
			<TextBox Name="Deployment" VerticalContentAlignment="Center" Grid.Row="2">
				<TextBox.Text>
					<Binding Path="Destination" UpdateSourceTrigger="PropertyChanged">
						<Binding.ValidationRules>
							<local:ValidUriRule/>
						</Binding.ValidationRules>
					</Binding>
				</TextBox.Text>
			</TextBox>
		</Grid>
		<Grid Grid.Row="1"> 
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition/>
			</Grid.ColumnDefinitions>
			<StackPanel Grid.Column="0" Margin="20,5,10,5" HorizontalAlignment="Left" Width="152">
				<Button Content="Check for new version" Height="23" Margin="0,5,0,0" Command="{Binding CheckVersion}"/>
				<Button Content="Download new version" Height="23" Margin="0,5,0,0" Command="{Binding Download}"/>
				<Button Content="Install new version" Height="23" Margin="0,5,0,0" Command="{Binding Install}"/>
			</StackPanel>
			<Grid Grid.Column="1" Margin="0,5,0,0">
				<Grid.ColumnDefinitions>
					<ColumnDefinition/>
					<ColumnDefinition/>
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition/>
				</Grid.RowDefinitions>
				<!--fields-->
				<TextBlock Text="Current version" Margin="2,5"/>
				<TextBlock Grid.Row="1" Text="Latest version" Margin="2,5"/>
				<TextBlock Grid.Row="2" Text="Content" Margin="2,5"/>
				<!--Values-->
				<TextBlock Grid.Column="1" Text="{Binding Version}" Margin="2"/>
				<TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding LatestVersion}" Margin="2"/>
			</Grid>
		</Grid>

	</Grid>
</Window>
